#include <bits/stdc++.h>
using namespace std;

// 定义一个结构体来保存坐标和步数
struct Node {
    int x, y, dist;
};

int n, m, x, y;
int mx[1005][1005];
int dx[8] = {-2, -2, -1, -1, 2, 2, 1, 1};
int dy[8] = {1, -1, 2, -2, 1, -1, 2, -2};

void bfs(int x, int y) {
    queue<Node> q;
    q.push({x, y, 0});
    mx[x][y] = 0;

    while (!q.empty()) {
        Node node = q.front();
        q.pop();
        for (int i = 0;i < 8;i++) {
            int nx = node.x + dx[i];
            int ny = node.y + dy[i];
            //如果这个点合理存在且没被访问过
            if (nx > 0 && ny > 0 && nx <= n && ny <= m && mx[nx][ny] == -1) {
                mx[nx][ny] = node.dist + 1;
                q.push({nx, ny, mx[nx][ny]});
            }
        }
    }
}

int main() {
    cin >> n >> m >> x >> y;
    memset(mx,-1,sizeof(mx));

    bfs(x, y);

    for (int i = 1; i <= n;i++) {
        for (int j = 1; j <= m;j++) {
            cout << left << setw(5) << mx[i][j];
        }
        cout << "\n";
    }
}